﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProjectChords.Services.Models;
using ProjectChords.Services.API;

namespace ProjectChords.Services.Impl.Memory
{
    public class QuizProgressServiceInMemoryImpl : GenericInMemoryService<QuizProgress>, IQuizProgressService
    {
        public QuizProgressServiceInMemoryImpl()
            : base()
        {
        }

        public List<QuizProgress> GetAllProgressItemsForQuiz(string quizItemId)
        {
            // TODO: Think about this further.
            throw new NotImplementedException();
        }

        public List<QuizProgress> GetAllProgressItemsForStudent(string studentId)
        {
            return GetAllItemsForGivenConstraint(studentId);
        }

        public List<QuizProgress> GetAllCompletedProgressItemsForStudent(string studentId)
        {
            return GetAllProgressItemsForStudent(studentId).Where(x => x.CurrentStatus == QuizProgress.Status.COMPLETED).ToList();
        }

        public override string GetConstraintValue(QuizProgress obj)
        {
            return obj.Student.Id;
        }
    }
}
